Adding white noise to sine waves (2015.10.09 DW)


In [1]:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import sys
sys.path.insert(0, 'C:\Users\Dominik\Documents\GitRep\kt-2015-DSPHandsOn\MedianFilter\Python') #Add a new path with needed .py files

import functions
import gitInformation

In [2]:
gitInformation.printInformation()


Information about this notebook
============================================================
Date: 2015-11-10
Python Version: 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 16:44:52) [MSC v.1500 64 bit (AMD64)]
Git directory: C:\Users\Dominik\Documents\GitRep\kt-2015-DSPHandsOn\.git
Current git SHA: 3d75389fd98bd111b1e723db4da574f17ba90e9b
Remotes: fork, origin, 
Current branch: master
fork remote URL: http://github.com/dowa4213/kt-2015-DSPHandsOn.git
origin remote URL: https://github.com/ktakagaki/kt-2015-DSPHandsOn.git

In [3]:
%matplotlib inline

I am adding white noise to the sine wave to simulate a more realistic wave. Then I am plotting the sine waves with different wave numbers , the filtered wave and the difference between filtered and original wave.

Plot


In [ ]:
pp = PdfPages('median sin with white noise.pdf')
for z in range (3, 16, 2):
    # Creates different figures in one plot, z is the window length.
    fig = plt.figure(z, figsize=(30, 20))       
    for x in range(1, 5):
        for y in range(1, 6):
            # Creates different subplots in one figure, 
            # with x and y the wave number is calculated.
            plt.subplot(5, 5, x + (y-1)*4)
            wavenum = (x-1) + (y-1)*4
            functions.medianSinPlotNoised( wavenum, z )
            plt.suptitle('Median filtered, noised sine waves with window length ' 
                         + str(z), fontsize = 60)
            plt.xlabel(("Wave number = " + str((x-1) + (y-1)*4)), fontsize=18)
    pp.savefig(fig)
pp.close()